# Contributor: Grigory Kirillov <txgk@bk.ru>
# Maintainer:
pkgname=plfit
pkgver=0.9.6
pkgrel=0
pkgdesc="Tool for fitting power-law distributions to empirical data"
url="https://github.com/ntamas/plfit"
arch="all"
license="GPL-2.0-only"
makedepends="cmake samurai"
subpackages="$pkgname-static $pkgname-libs $pkgname-dev"
source="https://github.com/ntamas/plfit/archive/$pkgver/plfit-$pkgver.tar.gz"

build() {
	cmake -B builddir -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_BUILD_TYPE=Release \
		-DBUILD_SHARED_LIBS=ON
	cmake -B builddir-static -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_BUILD_TYPE=Release
	cmake --build builddir
	cmake --build builddir-static
}

check() {
	ctest --output-on-failure --test-dir builddir
}

package() {
	# Install static build first because we want the utilities to be linked dynamically.
	DESTDIR="$pkgdir" cmake --install builddir-static
	DESTDIR="$pkgdir" cmake --install builddir
}

sha512sums="
94aa2246da3c2fcbcc1abf12f9b0ac5a8a180c6c0204ebd3854b54cfae26263140a63cb1970c5dfdecd238e2cb6f8b2ad4e033b94e1ae128fc35002ed989b862  plfit-0.9.6.tar.gz
"
